CXXFLAGS+=-g3 -Wall -W -pedantic
LIBS=-lboost_program_options-mt -lboost_system-mt -lcrypto
PROG=sgconf-ng

SOURCES=main.cpp \
	sgconf.cpp

all: $(PROG) 

$(PROG): $(subst .cpp,.o,$(SOURCES))
	$(CXX) $^ $(LIBS) -o $@

clean:
	rm -f *.o *.d $(PROG)

ifneq ($(MAKECMDGOALS),distclean)
ifneq ($(MAKECMDGOALS),clean)
-include $(subst .cpp,.d,$(SOURCES))
endif
endif

%.d: %.cpp
	@$(CC) -MM $(CFLAGS) $< > $@.$$$$; \
	sed 's,\($*\).o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
	rm -f $@.$$$$
